package com.example.doctor.jpa;

import com.example.common.entity.XDrugTemplete;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author sifan
 * @PackagName:com.example.doctor.jpa
 * @ClassName: XDrugTempleteRepository
 * @Description:
 * @date:2021/1/22 16:42
 */
public interface XDrugTempleteRepository extends JpaRepository<XDrugTemplete,Long> {

    @Query(value = "SELECT * FROM x_drug_templete WHERE dc_id_bigint =:dcId and d_type_tinyint = :dType limit :skip ,:limit",nativeQuery = true)
    List<XDrugTemplete> findByDCid(@Param("dcId") Long dcId, @Param("dType") int dType,@Param("skip") Integer skip,@Param("limit") Integer limit);
    @Query(value = "SELECT count(*) FROM x_drug_templete WHERE dc_id_bigint =:dcId and d_type_tinyint = :dType ",nativeQuery = true)
    long countByDcIdAndDType( @Param("dcId") Long dcId, @Param("dType") int dType);
}
